package com.hexinfo.dmpro.monitor.controller;

import com.hexinfo.dmpro.common.annotation.AnonymousAccess;
import com.hexinfo.dmpro.common.annotation.Log;
import com.hexinfo.dmpro.monitor.service.CmStatementAuditService;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@RestController
@RequestMapping("/api/apiScheduledTasks")
public class ApiScheduledTasksController {

    @Resource
    private CmStatementAuditService statementAuditService;

    @Log("语句审计获取impala语句参数")
    @GetMapping("/getImpalaParameterData")
    @AnonymousAccess
    public ResponseEntity<Object> getImpalaParameterData() {
        statementAuditService.getImpalaParameterData();
        return new ResponseEntity<>(HttpStatus.OK);
    }

    @Log("语句审计获取yarn语句参数")
    @GetMapping("/getYarnParameterData")
    @AnonymousAccess
    public ResponseEntity<Object> getYarnParameterData() {
        statementAuditService.getYarnParameterData();
        return new ResponseEntity<>(HttpStatus.OK);
    }

}
